home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Button;
- import java.awt.Frame;
- import java.awt.Window;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.WindowEvent;
- import java.awt.event.WindowListener;
- import java.net.URL;
- import java.util.EventObject;
-
- class LoginFrame extends Frame implements WindowListener, ActionListener {
- // $FF: renamed from: lb PasswordedDownload
- PasswordedDownload field_0;
-
- LoginFrame(String title, PasswordedDownload lb) {
- super(title);
- this.field_0 = lb;
- ((Window)this).addWindowListener(this);
- }
-
- public void windowClosing(WindowEvent e) {
- ((Frame)this).dispose();
- }
-
- public void windowClosed(WindowEvent e) {
- }
-
- public void windowOpened(WindowEvent e) {
- }
-
- public void windowIconified(WindowEvent e) {
- }
-
- public void windowDeiconified(WindowEvent e) {
- }
-
- public void windowActivated(WindowEvent e) {
- }
-
- public void windowDeactivated(WindowEvent e) {
- }
-
- public String decode(String codeBase) {
- char[] chars = new char[codeBase.length()];
- codeBase.getChars(0, codeBase.length(), chars, 0);
- String key = new String("haricots");
- char[] chars2 = new char[key.length()];
- key.getChars(0, key.length(), chars2, 0);
- int k = 0;
-
- for(int i = 0; i < codeBase.length(); ++i) {
- ++k;
- if (k == 4) {
- k = 1;
- }
-
- if (i >= key.length()) {
- int var10000 = i - key.length() * (i / key.length());
- }
-
- chars[i] = (char)(chars[i] - k);
- }
-
- String res = new String(chars);
- return res;
- }
-
- public void actionPerformed(ActionEvent evt) {
- Button b = (Button)((EventObject)evt).getSource();
- if (b.getLabel().equals("Cancel")) {
- ((Frame)this).dispose();
- this.field_0.stop();
- } else {
- if (b.getLabel().equals("Ok")) {
- String pass = this.field_0.t2.getText();
- String passvrai = this.field_0.getParameter("password");
- System.out.println(this.decode(passvrai));
- if (this.decode(passvrai).equals(pass)) {
- URL u = this.field_0.giveURL(this.decode(this.field_0.getParameter("link")));
- ((Frame)this).dispose();
- String target = this.field_0.getParameter("target");
- if (target == null) {
- target = "_blank";
- }
-
- this.field_0.getAppletContext().showDocument(u, target);
- this.field_0.stop();
- return;
- }
-
- ((Frame)this).setTitle(this.field_0.title + ": wrong password !");
- this.field_0.t2.setText("");
- }
-
- }
- }
- }
-